﻿using System.Linq;

namespace System
{
	public static class GuidExtensions
	{
		public static int ToInt(this Guid guid)
		{
			var _bytes = guid.ToByteArray();
			return
				((int)_bytes[0])
				| ((int)_bytes[1] << 8)
				| ((int)_bytes[2] << 16)
				| ((int)_bytes[3] << 24);
		}

		public static Guid ToGuid(this int a)
		{
			return new Guid(a, 0, 0, Enumerable.Repeat<byte>(0, 8).ToArray());
		}
	}
}
